﻿using ServiceProxy;

namespace CalculatorFour
{
    /// <summary>
    /// Implementation of a calculator which provides simple arithmetic operations
    /// </summary>
    public class Calculator
    {
        private readonly IProxyFactory proxyFactory;

        public Calculator(IProxyFactory proxyFactory)
        {
            this.proxyFactory = proxyFactory;
        }

        /// <summary>
        /// Adds two numbers and returns the result
        /// </summary>
        /// <param name="numberOne"></param>
        /// <param name="numberTwo"></param>
        /// <returns></returns>
        public float Add(float numberOne, float numberTwo)
        {
            return proxyFactory.GetProxy<ICalculatorChannel>("ICalculator").Execute(c => c.add(numberOne, numberTwo));
        }
    }
}